import fetch from "./../fetch.js";

// 获取角色列表
const getRoleList = (params) => {
  return fetch({
    url: "/system/roleManage/roleList",
    method: "post",
    data: JSON.stringify(params),
  });
};

// 查询角色所属用户列表
const getRoleUserList = (params) => {
  return fetch({
    url: "/system/roleManage/roleUserList",
    method: "post",
    data: JSON.stringify(params),
  });
};
// 查看该角色权限列表
const getRolePermissionList = (params) => {
  return fetch({
    url: "/system/roleManage/rolePermissionList",
    method: "post",
    data: JSON.stringify(params),
  });
};

// 添加角色
const roleAdd = (params) => {
  return fetch({
    url: "/system/roleManage/roleAdd",
    method: "post",
    data: JSON.stringify(params),
  });
};

// 修改角色
const roleUpdate = (params) => {
  return fetch({
    url: "/system/roleManage/roleUpdate",
    method: "post",
    data: JSON.stringify(params),
  });
};

// 修改角色
const roleDelete = (params) => {
  return fetch({
    url: "/system/roleManage/roleDelete",
    method: "post",
    data: JSON.stringify(params),
  });
};

// 修改角色权限
const rolePermissionUpdate = (params) => {
  return fetch({
    url: "/system/roleManage/rolePermissionUpdate",
    method: "post",
    data: JSON.stringify(params),
  });
};

// 获取用户账户列表
const userAccountList = (params) => {
  return fetch({
    url: "/organization/management/UserAccountList",
    method: "post",
    data: JSON.stringify(params),
  });
};

//添加用户账户
const userAccountAdd = (params) => {
  return fetch({
    url: "/organization/management/userAccountAdd",
    method: "post",
    data: JSON.stringify(params),
  });
};

// 获取用户详情
const getUserDetail = (params) => {
  return fetch({
    url: "/organization/management/getUserDetail",
    method: "post",
    data: JSON.stringify(params),
  });
};

// 修改用户账户
const userAccountUpdate = (params) => {
  return fetch({
    url: "/organization/management/userAccountUpdate",
    method: "post",
    data: JSON.stringify(params),
  });
};

// 删除用户账户
const deleteAccount = (params) => {
  return fetch({
    url: "/organization/management/deleteAccount",
    method: "post",
    data: JSON.stringify(params),
  });
};

// 重置密保
const resetPasswordProtection = (params) => {
  return fetch({
    url: "/organization/management/resetPasswordProtection",
    method: "post",
    data: JSON.stringify(params),
  });
};

// 重置密码
const resetPassword = (params) => {
  return fetch({
    url: "/organization/management/resetPassword",
    method: "post",
    data: JSON.stringify(params),
  });
};

export default {
  getRoleList,
  getRoleUserList,
  getRolePermissionList,
  roleAdd,
  roleUpdate,
  roleDelete,
  rolePermissionUpdate,
  userAccountList,
  userAccountAdd,
  getUserDetail,
  userAccountUpdate,
  deleteAccount,
  resetPasswordProtection,
  resetPassword
};
